import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import SuperHome from '../views/SuperHome'
import Login from '../views/Login'
import Admins from '../components/Admins'
import Alert from '../components/Alert'
import Health from '../components/Health'
import Travel from '../components/Travel'
import Users from '../components/Users'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  // 可以根据name或path跳转
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children: [
      {
        path: 'users',
        name: 'users',
        component: Users
      },
      {
        path: 'health',
        name: 'health',
        component: Health
      },
      {
        path: 'travel',
        name: 'travel',
        component: Travel
      },
      {
        path: 'alert',
        name: 'alert',
        component: Alert
      }
    ]
  },
  {
    path: '/superHome',
    name: 'superHome',
    component: SuperHome,
    children: [
      {
        path: 'admins',
        name: 'admins',
        component: Admins
      },
      {
        path: 'users',
        name: 'users',
        component: Users
      },
      {
        path: 'health',
        name: 'health',
        component: Health
      },
      {
        path: 'travel',
        name: 'travel',
        component: Travel
      },
      {
        path: 'alert',
        name: 'alert',
        component: Alert
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
